package com.yidu.hbatsams.service.Impl;

import com.yidu.hbatsams.dao.AtsSchemeAuditMapper;
import com.yidu.hbatsams.domain.AtsSchemeAudit;
import com.yidu.hbatsams.service.AtsSchemeAuditFsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
@Service
public class AtsSchemeAuditFsImpl implements AtsSchemeAuditFsService {
    @Resource
    private AtsSchemeAuditMapper daoMapper;

    @Override
    public int insertSelective(AtsSchemeAudit record) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        record.setRemark("运动营养方案");
        record.setAuTime(simpleDateFormat.format(new java.sql.Date(System.currentTimeMillis())));
        record.setIsva(1);
        record.setCreatTime(new java.sql.Date(System.currentTimeMillis()));
        return daoMapper.insert(record);
    }

    @Override
    public List<AtsSchemeAudit> selectAll() {
        List<AtsSchemeAudit> list=daoMapper.selectAll();
        return list;
    }

    @Override
    public AtsSchemeAudit selectByPrimaryKey(Integer auId) {
        return daoMapper.selectByPrimaryKey(auId);
    }

    @Override
    public int deleteScheme(Integer schemeId) {
        return daoMapper.deleteScheme(schemeId);
    }

    @Override
    public int updateSchemeName(Integer schemeId, String saName) {
        String saId = String.valueOf(schemeId);
        return daoMapper.updateSchemeName(saId,saName);
    }

    @Override
    public int updateAuditState(String saId, String auditState) {
        return daoMapper.updateAuditState(saId,auditState);
    }

    @Override
    public AtsSchemeAudit selectAuditBySaId(String saId) {
        return daoMapper.selectAuditBySaId(saId);
    }

    @Override
    public int updateByPrimaryKeySelectiveFs(AtsSchemeAudit record) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        record.setRemark("运动营养方案");
        record.setAuTime(simpleDateFormat.format(new java.sql.Date(System.currentTimeMillis())));
        record.setIsva(1);
        record.setCreatTime(new java.sql.Date(System.currentTimeMillis()));
        return daoMapper.updateByPrimaryKeySelectiveFs(record);
    }
}
